package services.communication.mail._static;

import org.example.www.communication.MailService.CommunicationMailService_PortType;
import org.example.www.communication.MailService.CommunicationMailService_ServiceLocator;
import org.example.www.communication.MailService.EMail;

/**
 * La clase es un proxy estatico para acceder al web-service de comunicacion de
 * e-mails.<BR/>
 * <BR/>
 * <BR/>
 * NOTA: La clase fue auto-generada desde el archivo
 * communicationMailService.wsdl.
 */
public class CommunicationMailServiceProxy implements
		CommunicationMailService_PortType {
	
	private String								_endpoint							= null;
	
	private CommunicationMailService_PortType	communicationMailService_PortType	= null;
	
	public CommunicationMailServiceProxy() {
		_initCommunicationMailServiceProxy();
	}
	
	public CommunicationMailServiceProxy(String endpoint) {
		_endpoint = endpoint;
		_initCommunicationMailServiceProxy();
	}
	
	private void _initCommunicationMailServiceProxy() {
		try {
			communicationMailService_PortType = (new CommunicationMailService_ServiceLocator())
					.getcommunicationMailServiceSOAP();
			if (communicationMailService_PortType != null) {
				if (_endpoint != null)
					((javax.xml.rpc.Stub) communicationMailService_PortType)
							._setProperty(
									"javax.xml.rpc.service.endpoint.address",
									_endpoint);
				else
					_endpoint = (String) ((javax.xml.rpc.Stub) communicationMailService_PortType)
							._getProperty("javax.xml.rpc.service.endpoint.address");
			}
			
		} catch (javax.xml.rpc.ServiceException serviceException) {
		}
	}
	
	public String getEndpoint() {
		return _endpoint;
	}
	
	public void setEndpoint(String endpoint) {
		_endpoint = endpoint;
		if (communicationMailService_PortType != null)
			((javax.xml.rpc.Stub) communicationMailService_PortType)
					._setProperty("javax.xml.rpc.service.endpoint.address",
							_endpoint);
		
	}
	
	public CommunicationMailService_PortType getCommunicationMailService_PortType() {
		if (communicationMailService_PortType == null)
			_initCommunicationMailServiceProxy();
		return communicationMailService_PortType;
	}
	
	public boolean sendEMail(EMail in) throws java.rmi.RemoteException {
		if (communicationMailService_PortType == null)
			_initCommunicationMailServiceProxy();
		return communicationMailService_PortType.sendEMail(in);
	}
	
	public EMail[] reciveEMails(String in) throws java.rmi.RemoteException {
		if (communicationMailService_PortType == null)
			_initCommunicationMailServiceProxy();
		return communicationMailService_PortType.reciveEMails(in);
	}
	
}
